//
//  MBReleaseModel.m
//  发布求租
//
//  Created by MB__Lee on 2018/6/7.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "MBReleaseModel.h"

@implementation MBReleaseModel
-(void)MBJsonString{
    if ([self.category isEqualToString:@"1001"]) {
        if (self.fang_bedroom.count) {
            self.jsonBed = [self MBJSON_WithArr:self.fang_bedroom];
            self.fang_bedroom = nil;
        }
        if (self.fang_characteristic) {
            self.jsonBed_charact = [self MBJSON_WithArr:self.fang_characteristic];
            self.fang_characteristic = nil;
        }
        
        
        
        
    }else if ([self.category isEqualToString:@"1003"]){
        
        if (self.office_type.count) {
            self.jsonOffice =  [self MBJSON_WithArr:self.office_type];
            self.office_type = nil;
        }
        if (self.office_characteristic.count) {
            self.jsonBed_charact = [self MBJSON_WithArr:self.office_characteristic];
            self.jsonOffice_character = nil;
        }
        
        
    }else if ([self.category isEqualToString:@"1004"]){
        
        if (self.shop_type) {
            self.jsonShop = [self MBJSON_WithArr:self.shop_type];
            self.shop_type = nil;
            
        }
        if (self.shop_characteristic) {
            self.jsonShop_charact = [self MBJSON_WithArr:self.shop_characteristic];
            self.shop_characteristic = nil;
        }
        
        
    }
    
    
    
    
}
-(NSString *)MBJSON_WithArr:(NSArray *)arr{
    
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:arr options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *str  =[[NSString alloc] initWithData:jsonData encoding:4];
    return  str;
    
}

@end
